package com.houdoudou.com.owner;

import www.houdoudou.com.supplier.SupplierManagement;

import com.houdoudou.com.machine.MachineDistributeManagement;
import com.houdoudou.com.machine.MachineManage;

import net.sf.json.JSONObject;

public class OwnerDoSth {

	public static JSONObject manageMachine(String jsonData){
		JSONObject result = new JSONObject();
		//	JSONObject jsonfrom= JSONObject.fromObject(jsonData);			
			JSONObject jsoncheck= OwnerManagement.loginCheck(jsonData);
			
			if(jsoncheck.getBoolean("ActionStatus")){
				result =MachineManage.manageMachine(jsonData);	
			}else{
				result.put("ActionStatus", false);
				result.put("ErrorInfo", "登陆存储不正确");
			}
			
			return result;
	}
	
	public static JSONObject manageSelf(String jsonData){
		JSONObject result = new JSONObject();
		//	JSONObject jsonfrom= JSONObject.fromObject(jsonData);			
			JSONObject jsoncheck= OwnerManagement.loginCheck(jsonData);
			
			if(jsoncheck.getBoolean("ActionStatus")){
				result =OwnerManagement.managerOwner(jsonData);
			}else{
				result.put("ActionStatus", false);
				result.put("ErrorInfo", "登陆存储不正确");
			}
			
			return result;
	}
	
	public static JSONObject manageSupplier(String jsonData){
		JSONObject result = new JSONObject();
		//	JSONObject jsonfrom= JSONObject.fromObject(jsonData);			
			JSONObject jsoncheck= OwnerManagement.loginCheck(jsonData);
			
			if(jsoncheck.getBoolean("ActionStatus")){
				result =SupplierManagement.managerSupplier(jsonData);
			}else{
				result.put("ActionStatus", false);
				result.put("ErrorInfo", "登陆存储不正确");
			}
			
			return result;
	}
	
	public static JSONObject manageDistribute(String jsonData){
		JSONObject result = new JSONObject();
		//	JSONObject jsonfrom= JSONObject.fromObject(jsonData);			
			JSONObject jsoncheck= OwnerManagement.loginCheck(jsonData);
			
			if(jsoncheck.getBoolean("ActionStatus")){
				result =MachineDistributeManagement.manage(jsonData);
			}else{
				result.put("ActionStatus", false);
				result.put("ErrorInfo", "登陆存储不正确");
			}
			
			return result;
	}
	
	
}
